package com.jumi.microservice.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumi.microservice.entity.CommonGroup;
import com.jumi.microservice.entity.JmUserTeam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 要挑客户管理团队
 * @since 2020-07-14
 */
public interface JmUserTeamMapper extends BaseMapper<JmUserTeam> {

    @Select("select count(1) c  from jm_user_team ${ew.customSqlSegment} ")
    Integer getSumChiNum(@Param(Constants.WRAPPER) QueryWrapper wrapper);

    Page getMyTeam(Page page, @Param(Constants.WRAPPER) QueryWrapper wrapper, @Param("teamUid") Integer teamUid);

    Page getMyDirectTeam(Page page, @Param(Constants.WRAPPER) QueryWrapper wrapper, @Param("teamUid") Integer teamUid);

    @Select("select join_type type,count(1) count from jm_user_team ${ew.customSqlSegment}")
    List<CommonGroup> getTeamNumsByInviterType(@Param(Constants.WRAPPER) QueryWrapper wrapper);
}
